package com.coderside.fragment.synthesizer;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class IntegerComparator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Comparator<Integer> c = new Comparator<Integer>() {
			public int compare(Integer i1, Integer i2) {
				//return i1 - i2;// 升序 当排序的ID大于Integer.MAX_VALUE 就会出现错误
				return (i1 < i2 ? -1 : (i1 == i2 ? 0 : 1));
			}
		};
		List<Integer> l = new ArrayList<Integer>();
		l.add(new Integer(-2000000000));
		l.add(new Integer(2000000000));
		Collections.sort(l, c);
		System.out.println(l);// [2000000000, -2000000000]
	}

}
